<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>意见反馈页面</title>
<jsp:include page="/WEB-INF/backstage/util.jsp" />
<script type="text/javascript">
	function test(obj) {
		if (obj.value == "true ") {
			obj.value = "false";
		} else {
			obj.value = "true";
		}
		var num = document.getElementsByName("num");
		for (var i = 0; i < num.length; i++) {
			num[i].checked = !num[i].checked;
		}
	}
//全选删除单选删除
$(document).ready(function(){
	$("#BeleteBtn").click(function(obj) {//绑定
				var array = "";
				var num = document.getElementsByName("opinion_id");
				for (var i = 0; i < num.length; i++) {
				if (num[i].checked) {
				array += num[i].value + ",";
								}
							}
				if (array.length > 0) {
				array = array.substring(0,array.length - 1);
				document.forms[0].action = "/bsc/Bis_opinion/delete?ids="+ array;
				document.forms[0].submit();
				} else {
				alert("你还未选取数据");
								}
							});
	$("#btn").click(function() {//绑定
		var opinion_id='';	
	  var count=0;
		var num = document.getElementsByName("opinion_id");
		for (var i = 0; i < num.length; i++) {
		if (num[i].checked) {
		  count++;
		  opinion_id=num[i].value;
		}
		}
		if(count==0){
			alert("请选择信息");
		}else if(count>1){
			alert("查看详情时只能选择一个");
		}else{
			$("#myModal").modal("show");
			$.post("/bsc/Bis_opinion/select?opinion_id="+opinion_id,function(msg){
				$("#content").val(msg.content);
			});
		}
	});
	$("#close").click(function(){
		$("#content").val("");
		$("#myModal").modal("hide");
	})
});
</script>
</head>
<body>
<form action="" method="post" class="form-inline">
	<div class="form-inline">
		<div class="form-group">
		<label for="opinion_id">手机号:</label><input type="text"
			class="form-control" id="opinion_id" name="opinion_id"
			placeholder="请输入手机号" >
		</div>
		<div class="form-group">
		<label for="content">内容:</label> <input type="text"
			class="form-control" name="content"
			placeholder="请输入内容" >
		</div>
		 <div class="form-group">
		<label for="create_time1"> 发送日期:</label> <input type="date"
			class="form-control" name="create_time1"
			placeholder="请输入 发送日期" >
		</div>
		<div class="form-group">
	 	<label for="create_time2"> 至:</label> <input type="date"
			class="form-control" name="create_time2"
			placeholder="请输入 接受日期"> 
		</div> 
	
		<button type="submit" class="btn btn-primary" >
			<span class="glyphicon glyphicon-search" ></span>提交
		</button>
		<button type="reset" class="btn btn-primary" >
			<span class="glyphicon glyphicon-info"></span>重置
		</button>
	</div>
	
	</form>
		<button type="button" id="btn" class="btn btn-primary" >
 		查看意见
		</button>
			<input type="button" value="删除" id="BeleteBtn" class="btn btn-primary">
		<table class="table-hover table-condensed table-bordered" width="100%">
			<tr>
				<td><input type="checkbox" name="" id="" onclick="test(this)" />手机号</td>
				<td>内容</td>
				<td>发送时间</td>
			</tr>
			<c:forEach items="${selectBis_opinion }" var="selectBis_opinion">
				<tr>
					<td><input type="checkbox" name="opinion_id" value="${selectBis_opinion.opinion_id}" />${selectBis_opinion.bis_custom_user.mobile}</td>
					<td>${selectBis_opinion.content }</td>
					<td><fmt:formatDate value="${selectBis_opinion.create_time }"
							pattern="yyyy-MM-dd" /></td>
				</tr>
			</c:forEach>
		</table>
		一共1页,3条,当前在0,每页显示:5,当前页3
	<a href="#" onclick="upPage1()">上一页</a>
	<a href="#" onclick="nextPage1()">下一页</a>
	<a href="#" onclick="firstPage1()">首页</a>
	<a href="#" onclick="lastPage1()">尾页</a>
	<input type="text" size="3" name="page" id="page">
	<button type="button" onclick="tiaozhuan()">跳转</button>
	<!-- 模特框-->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">意见信息</h4>
      </div>
      <div class="modal-body">
        内容:<input type="text" id="content"/><br>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="close">关闭</button>
      </div>
    </div>
  </div>
</div>
<script>
//上一页
function upPage1(){
	pageForm.action="/bsc/Bis_opinion/selectBis_opinion?page=0";
	pageForm.submit();
}
//下一页
function nextPage1(){
	pageForm.action="/bsc/Bis_opinion/selectBis_opinion?page=1";
	pageForm.submit();
}
//首页
function firstPage1(){
	pageForm.action="/bsc/Bis_opinion/selectBis_opinion?page=1";
	pageForm.submit();
}
//尾页
function lastPage1(){
	pageForm.action="/bsc/Bis_opinion/selectBis_opinion?page=1";
	pageForm.submit();
}
//跳转
function tiaozhuan(){
	var page=$("#page").val();
	if(page>'1'){
		alert("没有这么多页..");
		return;
	}
	pageForm.action="/bsc/Bis_opinion/selectBis_opinion";
	pageForm.submit();
}
</script>
</body>
</html>